#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>

typedef int ElementType;
void wtf_sort(ElementType arr[],int n);

void wtf_sort(ElementType arr[],int n){
	int tmp;
	for(int i=n-1;i>0;i--){
		for(int j=0;j<i;j++){
			if( arr[j] > arr[j+1] ){
				tmp=arr[j+1];
				arr[j+1]=arr[j];
				arr[j]=tmp;
			}
		}
	}
}

void prt(ElementType arr[],int n){
	for(int i=0;i<n;i++)
		printf("%3d ",arr[i]);
	printf("\n");
}
/*
	make sure num>=1
*/
void heap_sort(ElementType arr[],int num){
	//build max heap
	int tmp;
	int n=num-1;
	for(int i=(n-1)/2;i>=0;i--){
		int j=i;
		tmp=arr[j];
		while( 2*j+1<=n ){
			if( 2*j+1 != n && arr[2*j+1] < arr[2*j+2] && tmp < arr[2*j+2] ){
				arr[j]=arr[2*j+2];
				j=2*j+2;
			}else if( arr[2*j+1] > tmp ){
				arr[j]=arr[2*j+1];
				j=2*j+1;
			}else{
				break;	
			}
		}
		arr[j]=tmp;
	}
	for(int i=n;i>=0;i--){
		tmp=arr[i];
		arr[i]=arr[0];
		int j=0;
		while( 2*j+1<=i-1 ){
			if( 2*j+1 < i-1 && arr[2*j+1] < arr[2*j+2] && tmp < arr[2*j+2] ){
				arr[j]=arr[2*j+2];
				j=2*j+2;
			}else if( arr[2*j+1] > tmp ){
				arr[j]=arr[2*j+1];
				j=2*j+1;
			}else
				break;
		}
		arr[j]=tmp;
	}
	return;
	// arr[p]=arrp[1]
	// 
}

void insert_sort(ElementType arr[],int n){
	ElementType tmp;
	for(int s=1;s<n;s++){
		tmp=arr[s];
		int i=s-1;
		while( i>=0 && arr[i] > tmp ){
			arr[i+1]=arr[i];
			i--;
		}
		arr[i+1]=tmp;
	}
	return;
}

void mg_sort(ElementType arr[],ElementType tmp[],int i1,int i2){
	if( i1 == i2 )
		return;
	mg_sort(arr,tmp,i1,(i1+i2)/2);
	mg_sort(arr,tmp,(i1+i2)/2+1,i2);
	int pa=i1,pb=(i1+i2)/2+1,pc=i1;
	int ca=(i1+i2)/2-i1+1;
	int cb=i2-(i1+i2)/2;
	while( ca > 0 && cb > 0 ){
		if( arr[pa] <= arr[pb] ){
			tmp[pc++]=arr[pa++];
			ca--;
		}else{
			tmp[pc++]=arr[pb++];
			cb--;
		}
	}
	while( ca-- )
		tmp[pc++]=arr[pa++];
	while( cb-- )
		tmp[pc++]=arr[pb++];
	memcpy(arr+i1,tmp+i1,(i2-i1+1)*sizeof(ElementType));
	return;
}
void merge_sort(ElementType arr[],int n){
	ElementType *tmp=malloc(sizeof(ElementType)*n);
	mg_sort(arr,tmp,0,n-1);
	//memcpy(arr,tmp,n*sizeof(ElementType));
	free(tmp);
	return;
}

void ms(ElementType arr[],ElementType tmp[],int i1,int mid,int i2,int i2end){
	if( i1 == i2 )return;
	int pa=i1,pc=i1;
	int pb=i2;
	int ca=mid-i1+1;
	int cb=i2end-i2+1;
	while( ca>0 && cb>0 ){
		if( arr[pa] <= arr[pb] ){
			tmp[pc++]=arr[pa++];
			ca--;
		}else{
			tmp[pc++]=arr[pb++];
			cb--;
		}
	}
	while( ca-- )
		tmp[pc++]=arr[pa++];
	while( cb-- )
		tmp[pc++]=arr[pb++];
	memcpy(arr+i1,tmp+i1,sizeof(ElementType)*(i2end-i1+1));
	return;
}

void merge_sort2(ElementType arr[],int n){
/*
	ElementType *tmp=malloc(sizeof(ElementType)*n);
	for(int block=1;block<=n;block+=block){
		int i;
		for(i=0; i+block <= n-1 ;i+=block){
			ms(arr,tmp,i,(2*i+block-1)/2,i+block-1);
printf("ms(%3d,%3d,%3d) ",i,(2*i+block-1)/2,i+block-1);
		}
		if( n-i > block/2 ){
			ms(arr,tmp,i,i+block/2-1,n-1);
printf("ms(%3d,%3d,%3d)",i,i+block/2-1,n-1);
		}
printf("\n");
*/
	ElementType *tmp=malloc(sizeof(ElementType)*n);	
	int block=1;
	do{
		block+=block;
		int i;
		for(i=0;i+block<n;i+=block){
			ms(arr,tmp,i,i+block/2-1,i+block/2,i+block-1);
//printf("ms(%3d,%3d,%3d,%3d)  ",i,i+block/2-1,i+block/2,i+block-1);
		}
		if( n-i > block/2 ){
			ms(arr,tmp,i,i+block/2-1,i+block/2,n-1);
//printf("ms(%3d,%3d,%3d %3d)  ",i,i+block/2-1,i+block/2,n-1);
		}
			//printf("  no need");
//printf("\n");
	}while(block<n);
	free(tmp);
	return;
}

int main(){
	//int x[7]={3,1,4,1,5,9,2};
	//heap_sort(x,7);
	//prt(x,7);
	int n;
	scanf("%d",&n);
	int x[n];
	for(int i=0;i<n;i++)
		scanf("%d",&x[i]);
	//wtf_sort(x,n);
	//heap_sort(x,n);
	//insert_sort(x,n);
	merge_sort2(x,n);
	_Bool first=true;
	for(int i=0;i<n;i++){
		if( first ){
			printf("%d",x[i]);
			first=false;
		}else
			printf(" %d",x[i]);
	}
	return 0;
}
